package version1_0;

/**
 * @program:IntelliJ IDEA
 * @Description:游戏判断
 * @author:Mr.CheCheHuiBujianO
 * @data: 2022/7/12 12:42
 */

public class GameJudge {
    /**
     *@Description: 使用输入的两个手势进行游戏结果判断
     *@Param: [peopleGesture, computerGesture]
     *@return:java.lang.String
     *@Author: Mr.Lin
     *@Date: 2022/7/12 13:08
     */
    public String gameJudge(String peopleGesture,String computerGesture){
        //使用switch——case语句进行结果的判断
        //使用equals方法进行字符串是否相同进行判断
        String gameResult = null;
        if (peopleGesture.equals("石头")){
            switch (computerGesture){
                case "石头": gameResult = "平局";break;
                case "剪刀": gameResult = "失败";break;
                case "布": gameResult = "胜利";break;
                default:break;
            }
        }
        if (peopleGesture.equals("布")){
            switch (computerGesture){
                case "布": gameResult = "平局";break;
                case "剪刀": gameResult = "失败";break;
                case "石头": gameResult = "胜利";break;
                default:break;
            }
        }
        if (peopleGesture.equals("剪刀")){
            switch (computerGesture){
                case "剪刀": gameResult = "平局";break;
                case "石头": gameResult = "失败";break;
                case "布": gameResult = "胜利";break;
                default:break;
            }
        }
        return gameResult;
    }

    public void printResult(int gameWinTime,int gameLoseTime,int gameTime,String result){
        System.out.println("这句游戏结果为"+result+",现在游戏胜利"+gameWinTime+"局，"+"现在游戏失败了"+gameLoseTime+"局,现在游戏进行了"+gameTime+"局");
    }

}
